home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 32
/
Aminet 32 (1999)(Schatztruhe)[!][Aug 1999].iso
/
Aminet
/
comm
/
tcp
/
hserv.lha
/
hserv
/
cgi-bin
/
whois.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1999-05-24
|
1KB
|
51 lines
/*whois.rexx 1.0*/
signal on break_c
say "Content-type: text/html";say
say "<html><head><title>Whois</title></head><BODY>"
l="rexxsupport.library";if ~show("L",l) then;if ~addlib(l,0,-30) then call err "can't find" l
l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then call err "can't find" l
l="rxsocket.library";if ~show("L",l) then;if ~addlib(l,0,-30) then call err "can't find" l
parse arg a +11 who
select
when a~="searchText=" then call err "bad request"
when who=="" then call err "You must give me something to search for!"
otherwise nop
end
s=socket("INET","STREAM")
if s<0 then call err "no socket"
remote.addraddr=resolve("rs.internic.net")
if remote.addraddr=="-1" then call err "can't resolve rs.internic.net<BR>(Are you online?)"
remote.addrport=43
if connect(s,"REMOTE")<0 then call err "can't connect"
req="WHOIS" who||d2c(10)||d2c(13)
if send(s,req)~=length(req) then call err "send error"
say "<CENTER><STRONG>Whois results for '"who"'</STRONG></CENTER><BR><HR><PRE>"
r=1
do while r>0
r=recv(s,"BUF",256)>0
if r>0 then call writech("STDOUT",buf)
end
if r<0 then call err "recv error"
else say "</PRE></BODY></HTML>"
exit
break_c:
say
call err "break"
exit
err:
parse arg msg
say "<BR><h1><strong>Sorry, internal script error:<BR>"msg"</strong></h1></body>"
say "</html>"
exit